$('.new_bill').replaceWith("<%= escape_javascript(render :partial => "bills/form", :local => @bill) %>");
update_solds();
function update_solds(){
  $(".sold").each(function(){
    var row = $(this);
    var stock_id = $(this).find("input.stock_id").val()
    var stock = $("#sold_stocks").find("tr#".concat(stock_id))
    var company = stock.find(".company").text();
    var name = stock.find(".name").text();
    row.find(".name").text(name);
    row.find(".company").text(company);
  });
  update_bill_total();
}
